import {
  mockIp,
  mockReqId
} from '../../utils/mock';

export function genOrders(params) {
  const resp = {
    data: {
      pageNum: 1,
      pageSize: 10,
      totalCount: 7,
      orders: [{
          saasId: '88888888',
          storeId: '1000',
          storeName: '守艺织梦',
          uid: '88888888205468',
          parentOrderNo: '354021731671873099',
          orderId: '354021735982432279',
          orderNo: '354021731671873099',
          orderType: 0,
          orderSubType: 0,
          orderStatus: 5,
          orderSubStatus: null,
          totalAmount: '10010',
          goodsAmount: '10000',
          goodsAmountApp: '10000',
          paymentAmount: '9800',
          freightFee: '10',
          packageFee: '0',
          discountAmount: '9800',
          channelType: 0,
          channelSource: '',
          channelIdentity: '',
          remark: '',
          cancelType: null,
          cancelReasonType: null,
          cancelReason: null,
          rightsType: null,
          createTime: '1600350829291',
          orderItemVOs: [{
            id: '354021736133427225',
            orderNo: null,
            spuId: '3',
            skuId: '135696670',
            roomId: null,
            goodsMainType: 0,
            goodsViceType: 0,
            goodsName: '三灶编织文创笔筒',
            specifications: [{
              specTitle: '颜色',
              specValue: '贵族青'
            }],
            goodsPictureUrl: 'https://gitee.com/super_yangfeng/yimg/raw/master/三灶编织文创笔筒.png',
            originPrice: '0',
            actualPrice: '9800',
            buyQuantity: 1,
            itemTotalAmount: '9800',
            itemDiscountAmount: '9800',
            itemPaymentAmount: '0',
            goodsPaymentPrice: '0',
            tagPrice: null,
            tagText: null,
            outCode: null,
            labelVOs: null,
            buttonVOs: null,
          }, ],
          logisticsVO: {
            logisticsType: 1,
            logisticsNo: '',
            logisticsStatus: null,
            logisticsCompanyCode: '',
            logisticsCompanyName: '',
            receiverAddressId: '14',
            provinceCode: '440000',
            cityCode: '440300',
            countryCode: '440306',
            receiverProvince: '广东省',
            receiverCity: '深圳市',
            receiverCountry: '宝安区',
            receiverArea: '',
            receiverAddress: '沙井中心路28号丽沙花都xx栋xx号',
            receiverPostCode: '',
            receiverLongitude: '113.829127',
            receiverLatitude: '22.713649',
            receiverIdentity: '88888888205468',
            receiverPhone: '17612345678',
            receiverName: '测试用户',
            expectArrivalTime: null,
            senderName: '',
            senderPhone: '',
            senderAddress: '',
            sendTime: null,
            arrivalTime: null,
          },
          paymentVO: {
            payStatus: 1,
            amount: '20',
            currency: null,
            payType: null,
            payWay: null,
            payWayName: null,
            interactId: null,
            traceNo: null,
            channelTrxNo: null,
            period: null,
            payTime: null,
            paySuccessTime: null,
          },
          buttonVOs: [{
              primary: false,
              type: 2,
              name: '取消订单'
            },
            {
              primary: true,
              type: 1,
              name: '付款'
            },
          ],
          labelVOs: null,
          invoiceVO: null,
          couponAmount: null,
          autoCancelTime: '1600352629291',
          orderStatusName: '待付款',
          orderSatusRemark: '需支付￥98',
          logisticsLogVO: null,
          invoiceStatus: null,
          invoiceDesc: null,
          invoiceUrl: null,
        },

        {
          saasId: '88888888',
          storeId: '1000',
          storeName: '守艺织梦',
          uid: '88888888205468',
          parentOrderNo: '132381532610540875',
          orderId: '132381537256650240',
          orderNo: '132381532610540875',
          orderType: 0,
          orderSubType: 0,
          orderStatus: 10,
          orderSubStatus: null,
          totalAmount: '9800',
          goodsAmount: '9800',
          goodsAmountApp: '9800',
          paymentAmount: '9800',
          freightFee: '0',
          packageFee: '0',
          discountAmount: '9800',
          channelType: 0,
          channelSource: '',
          channelIdentity: '',
          remark: '',
          cancelType: null,
          cancelReasonType: null,
          cancelReason: null,
          rightsType: null,
          createTime: '1587140043980',
          orderItemVOs: [{
            id: '132381537407645696',
            orderNo: null,
            spuId: '0',
            skuId: '135676631',
            roomId: null,
            goodsMainType: 0,
            goodsViceType: 0,
            goodsName: '【织梦匠心之旅】-编织研学旅行路线定制',
            goodsPictureUrl: 'https://gitee.com/super_yangfeng/yimg/raw/master/wps1.png',
            originPrice: '9800',
            actualPrice: '9800',
            specifications: [{
              specTitle: '时长',
              specValue: '一天'
            }],
            buyQuantity: 1,
            itemTotalAmount: '9800',
            itemDiscountAmount: '9800',
            itemPaymentAmount: '9800',
            goodsPaymentPrice: '9800',
            tagPrice: null,
            tagText: null,
            outCode: null,
            labelVOs: null,
            buttonVOs: null,
          }, ],
          logisticsVO: {
            logisticsType: 1,
            logisticsNo: '',
            logisticsStatus: null,
            logisticsCompanyCode: '',
            logisticsCompanyName: '',
            receiverAddressId: '2',
            provinceCode: '440000',
            cityCode: '440300',
            countryCode: '440306',
            receiverProvince: '广东省',
            receiverCity: '深圳市',
            receiverCountry: '南山区',
            receiverArea: '',
            receiverAddress: '前海路333号阳光玫瑰园',
            receiverPostCode: '',
            receiverLongitude: '113.829127',
            receiverLatitude: '22.713649',
            receiverIdentity: '88888888205468',
            receiverPhone: '17612345678',
            receiverName: '平均线',
            expectArrivalTime: null,
            senderName: '',
            senderPhone: '',
            senderAddress: '',
            sendTime: null,
            arrivalTime: null,
          },
          paymentVO: {
            payStatus: 1,
            amount: '36800',
            currency: null,
            payType: null,
            payWay: null,
            payWayName: null,
            interactId: null,
            traceNo: null,
            channelTrxNo: null,
            period: null,
            payTime: null,
            paySuccessTime: null,
          },
          buttonVOs: [{
              primary: false,
              type: 2,
              name: '取消订单',
            },
            {
              primary: true,
              type: 9,
              name: '再次购买',
            },
          ],
          labelVOs: null,
          invoiceVO: null,
          couponAmount: null,
          autoCancelTime: null,
          orderStatusName: '待发货',
          orderSatusRemark: null,
          logisticsLogVO: null,
          invoiceStatus: null,
          invoiceDesc: null,
          invoiceUrl: null,
        },
        {
          saasId: '88888888',
          storeId: '1000',
          storeName: '守艺织梦',
          uid: '88888888205468',
          parentOrderNo: '132222623132329291',
          orderId: '132222629674264064',
          orderNo: '132222623132329291',
          orderType: 0,
          orderSubType: 0,
          orderStatus: 40,
          orderSubStatus: null,
          totalAmount: '9900',
          goodsAmount: '9900',
          goodsAmountApp: '9900',
          paymentAmount: '9900',
          freightFee: '0',
          packageFee: '0',
          discountAmount: '9900',
          channelType: 0,
          channelSource: '',
          channelIdentity: '',
          remark: '',
          cancelType: null,
          cancelReasonType: null,
          cancelReason: null,
          rightsType: null,
          createTime: '1587130572349',
          orderItemVOs: [{
            id: '132222629825260288',
            orderNo: null,
            spuId: '3',
            skuId: '135691622',
            roomId: null,
            goodsMainType: 0,
            goodsViceType: 0,
            goodsName: '三灶编织文创笔筒--实用且超级可爱的笔筒',
            goodsPictureUrl: 'https://gitee.com/super_yangfeng/yimg/raw/master/三灶编织文创笔筒.png',
            originPrice: '16900',
            actualPrice: '9900',
            specifications: [{
                specTitle: '颜色',
                specValue: '经典白'
              },
              {
                specTitle: '类型',
                specValue: '经典套装'
              },
            ],
            buyQuantity: 1,
            itemTotalAmount: '9900',
            itemDiscountAmount: '1337',
            itemPaymentAmount: '8563',
            goodsPaymentPrice: '8563',
            tagPrice: null,
            tagText: null,
            outCode: null,
            labelVOs: null,
            buttonVOs: null,
          }, ],
          logisticsVO: {
            logisticsType: 1,
            logisticsNo: '',
            logisticsStatus: null,
            logisticsCompanyCode: '',
            logisticsCompanyName: '',
            receiverAddressId: '2',
            provinceCode: '440000',
            cityCode: '440300',
            countryCode: '440306',
            receiverProvince: '广东省',
            receiverCity: '深圳市',
            receiverCountry: '南山区',
            receiverArea: '',
            receiverAddress: '前海路333号阳光玫瑰园',
            receiverPostCode: '',
            receiverLongitude: '113.829127',
            receiverLatitude: '22.713649',
            receiverIdentity: '88888888205468',
            receiverPhone: '17612345678',
            receiverName: '平均线',
            expectArrivalTime: null,
            senderName: '',
            senderPhone: '',
            senderAddress: '',
            sendTime: null,
            arrivalTime: null,
          },
          paymentVO: {
            payStatus: 1,
            amount: '458600',
            currency: null,
            payType: null,
            payWay: null,
            payWayName: null,
            interactId: null,
            traceNo: null,
            channelTrxNo: null,
            period: null,
            payTime: null,
            paySuccessTime: null,
          },
          buttonVOs: [{
            primary: true,
            type: 3,
            name: '确认收货',
          }, ],
          labelVOs: null,
          invoiceVO: null,
          couponAmount: null,
          autoCancelTime: null,
          orderStatusName: '待收货',
          orderSatusRemark: null,
          logisticsLogVO: null,
          invoiceStatus: null,
          invoiceDesc: null,
          invoiceUrl: null,
        },
        {
          saasId: '88888888',
          storeId: '1000',
          storeName: '守艺织梦',
          uid: '88888888205468',
          parentOrderNo: '130169571554503755',
          orderId: '130169572291521792',
          orderNo: '130169571554503755',
          orderType: 0,
          orderSubType: 0,
          orderStatus: 50,
          orderSubStatus: null,
          totalAmount: '52820',
          goodsAmount: '52820',
          goodsAmountApp: '52820',
          paymentAmount: '52820',
          freightFee: '0',
          packageFee: '0',
          discountAmount: '9800',
          channelType: 0,
          channelSource: '',
          channelIdentity: '',
          remark: '',
          cancelType: null,
          cancelReasonType: null,
          cancelReason: null,
          rightsType: null,
          createTime: '1587008200590',
          orderItemVOs: [{
            id: '130169572425740032',
            orderNo: null,
            spuId: '1',
            skuId: '135691631',
            roomId: null,
            goodsMainType: 0,
            goodsViceType: 0,
            goodsName: '【剪艺寻踪，三灶文化之旅】',
            goodsPictureUrl: 'https://gitee.com/super_yangfeng/yimg/raw/master/wps2.png',
            originPrice: '31900',
            actualPrice: '9800',
            specifications: [{
              specTitle: '时长',
              specValue: '全天'
            }],
            buyQuantity: 20,
            itemTotalAmount: '9800',
            itemDiscountAmount: '9800',
            itemPaymentAmount: '9800',
            goodsPaymentPrice: '9800',
            tagPrice: null,
            tagText: null,
            outCode: null,
            labelVOs: null,
            buttonVOs: [{
              primary: true,
              type: 4,
              name: '',
            }, ],
          }, ],
          logisticsVO: {
            logisticsType: 1,
            logisticsNo: '123',
            logisticsStatus: null,
            logisticsCompanyCode: 'zhongtong',
            logisticsCompanyName: '中通速递',
            receiverAddressId: '2',
            provinceCode: '440000',
            cityCode: '440300',
            countryCode: '440306',
            receiverProvince: '广东省',
            receiverCity: '深圳市',
            receiverCountry: '南山区',
            receiverArea: '',
            receiverAddress: '前海路333号阳光玫瑰园',
            receiverPostCode: '',
            receiverLongitude: '113.829127',
            receiverLatitude: '22.713649',
            receiverIdentity: '88888888205468',
            receiverPhone: '17612345678',
            receiverName: '平均线',
            expectArrivalTime: null,
            senderName: '',
            senderPhone: '',
            senderAddress: '',
            sendTime: '1587008529453',
            arrivalTime: '1587008623995',
          },
          paymentVO: {
            payStatus: 1,
            amount: '9800',
            currency: null,
            payType: null,
            payWay: null,
            payWayName: null,
            interactId: null,
            traceNo: null,
            channelTrxNo: null,
            period: null,
            payTime: null,
            paySuccessTime: null,
          },
          buttonVOs: [{
              primary: false,
              type: 4,
              name: '申请售后'
            },
            {
              primary: true,
              type: 6,
              name: '评价'
            },
          ],
          labelVOs: null,
          invoiceVO: {
            buyerName: '腾讯计算机有限公司', //个人或公司名称
            buyerTaxNo: '9144 9808 0909 0293 XG', //税号
            buyerPhone: '18600008888', //手机
            email: '73900484@qq.com', //邮箱
            titleType: 2, //发票抬头 1-个人 2-公司
            ontentType: 1, //发票内容 1-明细 2类别
            invoiceType: 5, //是否开票 0-不开 5-电子发票
            money: '1.54',
          },
          couponAmount: null,
          autoCancelTime: null,
          orderStatusName: '交易完成',
          orderSatusRemark: null,
          logisticsLogVO: null,
          invoiceStatus: null,
          invoiceDesc: null,
          invoiceUrl: null,
        },
      ],
    },
    code: 'Success',
    msg: null,
    requestId: mockReqId(),
    clientIp: mockIp(),
    rt: 113,
    success: true,
  };
  const {
    pageNum,
    pageSize,
    orderStatus
  } = params.parameter;
  // 实现筛选
  if (orderStatus > -1) {
    resp.data.orders = resp.data.orders.filter(
      (order) => order.orderStatus === orderStatus,
    );
  }
  // 实现分页
  resp.data.pageNum = pageNum;
  resp.data.pageSize = pageSize;
  resp.data.orders = resp.data.orders.slice(
    (pageNum - 1) * pageSize,
    pageNum * pageSize,
  );
  return resp;
}

export function genOrdersCount() {
  const resp = {
    data: [{
        tabType: 5,
        orderNum: 1
      },
      {
        tabType: 10,
        orderNum: 1
      },
      {
        tabType: 40,
        orderNum: 1
      },
      {
        tabType: 50,
        orderNum: 2
      },
    ],
    code: 'Success',
    msg: null,
    requestId: mockReqId(),
    clientIp: mockIp(),
    rt: 41,
    success: true,
  };
  return resp;
}